from django.db import models
from django.utils import timezone


class Fraction(models.Model):
    DoesNotExist = None
    objects = None
    fraction = models.ForeignKey('accounts.Info', on_delete=models.CASCADE, verbose_name='关联学生')
    log = models.CharField(verbose_name='原因', max_length=64, null=True)
    action = models.CharField(verbose_name='变更分数', max_length=64, null=True)
    status = models.ForeignKey(to='workflows.State', verbose_name="状态", null=True, blank=True, help_text="状态",
                               on_delete=models.DO_NOTHING)
    created_at = models.DateTimeField(verbose_name='分数变更时间', default=timezone.now)

    class Meta:
        db_table = 'fraction_log'
        verbose_name = '分数日志'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.fraction

